#include "DodgeBomb.h"
#include "../Game.h"
#include "../SGD Wrappers\SGD_InputManager.h"
#include "../SGD Wrappers/SGD_AudioManager.h"
#include "GameState.h"
#include "MainMenuState.h"
#include "GameMode.h"
#include "../source/Runner.h"
#include "../source/Bomber.h"
#include "../source/Tank.h"
#include "../source/Striker.h"
#include "../tile/TileManager.h"
#include "../anim/AnimationManager.h"
#include "../SGD Wrappers/EntityManager.h"
#include "../source/Wall.h"
#include "../Punch.h"

#define BUCKET_PLAYERS 0
#define BUCKET_ENEMIES 1
#define BUCKET_GORBI 2
#define BUCKET_BALL 3
#define BUCKET_WALLS 4
#define BUCKET_POWERUPS 5
#define BUCKET_PUNCH 6

CDodgeBomb* CDodgeBomb::GetInstance(void)
{
	static CDodgeBomb s_Instance;
	return &s_Instance;
}

void CDodgeBomb::Enter(void)
{
	m_bMainGame = false;

	SGD::AudioManager::GetInstance()->PlayAudio(Game::GetInstance()->GetBoomSound(), false);
	boom = SGD::GraphicsManager::GetInstance()->LoadTexture("pictures/1407_IForgot_transistionscreen.png");


	CTileManager::GetInstance()->LoadLevel("Level2.xml");
	pParticleSys = CParticleManager::GetInstance();

	Game::GetInstance()->SetMiniGame(true);

	//m_pEntities = new EntityManager;

	m_TopWall = new CWall;
	m_TopWall->SetPosition({ 0, 0 });
	m_TopWall->SetSize({ Game::GetInstance()->GetScreenWidth() + 10, 1 });
	m_TopWall->SetColor({ 255, 0, 0, 0 });
	m_TopWall->SetImpentrable(true);
	m_pEntities->AddEntity(m_TopWall, BUCKET_WALLS);

	m_BotWall = new CWall;
	m_BotWall->SetPosition({ 0, Game::GetInstance()->GetScreenHeight() - 1 });
	m_BotWall->SetSize({ Game::GetInstance()->GetScreenWidth(), 10 });
	m_BotWall->SetColor({ 255, 0, 0, 0 });
	m_BotWall->SetImpentrable(true);
	m_pEntities->AddEntity(m_BotWall, BUCKET_WALLS);


	m_LeftWall = new CWall;
	m_LeftWall->SetPosition({ -10, 0 });
	m_LeftWall->SetSize({ 10, Game::GetInstance()->GetScreenHeight() + 10 });
	m_LeftWall->SetColor({ 255, 0, 0, 0 });
	m_LeftWall->SetImpentrable(true);
	m_pEntities->AddEntity(m_LeftWall, BUCKET_WALLS);

	m_RightWall = new CWall;
	m_RightWall->SetPosition({ Game::GetInstance()->GetScreenWidth() - 1, 0 });
	m_RightWall->SetSize({ 10, Game::GetInstance()->GetScreenHeight() + 10 });
	m_RightWall->SetColor({ 255, 0, 0, 0 });
	m_RightWall->SetImpentrable(true);
	m_pEntities->AddEntity(m_RightWall, BUCKET_WALLS);



	for (int numTallWalls = 0; numTallWalls < CTileManager::GetInstance()->GetCount(0); numTallWalls++)
	{
		CBall* testBall = dynamic_cast<CBall*>(CGameState::GetInstance()->CreateBall(CTileManager::GetInstance()->SpawnEntity(numTallWalls + 5), { 32, 32 }));
		testBall->SetColor({ 100, 255, 100 });
		testBall->m_bMiniGame = true;
		m_pEntities->AddEntity(testBall, BUCKET_BALL);
		ballSpawns.push_back(CTileManager::GetInstance()->SpawnEntity(numTallWalls + 6));
		testBall->Release();
	}

	m_pPlayer1->SetBall(nullptr);
	m_pPlayer2->SetBall(nullptr);
	m_pPlayer3->SetBall(nullptr);
	m_pPlayer4->SetBall(nullptr);
}

void CDodgeBomb::Exit(void)
{
	CTileManager::GetInstance()->UnloadLevel();
	CTileManager::DeleteInstance();
	if (!m_bMainGame)
	{
		CAnimationManager::GetInstance()->RemoveAll();
		CAnimationManager::GetInstance()->DeleteInstance();
	}
	SGD::GraphicsManager::GetInstance()->UnloadTexture(boom);

	m_uGameTime = 120;
	m_nDead = 0;
	m_bWon = false;
	m_fWinTimer = 5;

	if (m_pPlayer1 != nullptr)
	{
		m_pPlayer1->Release();
		m_pPlayer1 = nullptr;
	}

	if (m_pPlayer2 != nullptr)
	{
		m_pPlayer2->Release();
		m_pPlayer2 = nullptr;
	}

	if (m_pPlayer3 != nullptr)
	{
		m_pPlayer3->Release();
		m_pPlayer3 = nullptr;
	}

	if (m_pPlayer4 != nullptr)
	{
		m_pPlayer4->Release();
		m_pPlayer4 = nullptr;
	}

	if (m_BotWall != nullptr)
	{
		m_BotWall->Release();
		m_BotWall = nullptr;
	}

	if (m_LeftWall != nullptr)
	{
		m_LeftWall->Release();
		m_LeftWall = nullptr;
	}

	if (m_TopWall != nullptr)
	{
		m_TopWall->Release();
		m_TopWall = nullptr;
	}

	if (m_RightWall != nullptr)
	{
		m_RightWall->Release();
		m_RightWall = nullptr;
	}

	if (testBall != nullptr)
	{
		testBall->Release();
		testBall = nullptr;
	}

	if (m_pEntities != nullptr)
	{
		m_pEntities->RemoveAll();
		delete m_pEntities;
		m_pEntities = nullptr;
	}

	pParticleSys->DeleteInstance();
}

bool CDodgeBomb::Input(void)
{
	SGD::InputManager* pInput = SGD::InputManager::GetInstance();

	if (pInput->IsKeyPressed(SGD::Key::Escape) == true || pInput->IsButtonPressed(0, 1) == true)
	{
		Game::GetInstance()->ChangeState(CGameMode::GetInstance());
		return true;
	}

	if (pInput->IsKeyPressed(SGD::Key::Q) == true)
		m_uGameTime = 3;

	return true;
}

void CDodgeBomb::Update(float elapsedTime)
{

	time += elapsedTime;

	if (m_bWon)
		m_fWinTimer -= elapsedTime;

	if (time > 5.0f)
		flash = false;

	if (flash == false)
	{
		CAnimationManager::GetInstance()->UpdateAll(elapsedTime);

		m_uGameTime -= elapsedTime;

		CTileManager::GetInstance()->Update(0.15f);

		m_pEntities->UpdateAll(elapsedTime);

		m_pEntities->CheckCollisions(BUCKET_PLAYERS, BUCKET_PLAYERS);
		m_pEntities->CheckCollisions(BUCKET_PLAYERS, BUCKET_BALL);
		m_pEntities->CheckCollisions(BUCKET_PLAYERS, BUCKET_GORBI);
		m_pEntities->CheckCollisions(BUCKET_PLAYERS, BUCKET_WALLS);
		m_pEntities->CheckCollisions(BUCKET_PLAYERS, BUCKET_POWERUPS);
		m_pEntities->CheckCollisions(BUCKET_PLAYERS, BUCKET_ENEMIES);
		m_pEntities->CheckCollisions(BUCKET_GORBI, BUCKET_WALLS);
		m_pEntities->CheckCollisions(BUCKET_PLAYERS, BUCKET_PUNCH);
		m_pEntities->CheckCollisions(BUCKET_BALL, BUCKET_WALLS);

		//CTileManager::GetInstance()->BallCollision({ testBall->GetPosition(), testBall->GetSize() }, testBall);

		pParticleSys->UpdateAll(elapsedTime);
						
		if (m_uGameTime <= 0 || m_fWinTimer <= 0)
		{
			m_pPlayer1->SetCharge(60);
			m_pPlayer2->SetCharge(60);
			m_pPlayer3->SetCharge(60);
			m_pPlayer4->SetCharge(60);

			m_pPlayer1->SetAmIInAMiniGame(false);
			m_pPlayer2->SetAmIInAMiniGame(false);
			m_pPlayer3->SetAmIInAMiniGame(false);
			m_pPlayer4->SetAmIInAMiniGame(false);

			m_pPlayer1->ToggleActive(true);
			m_pPlayer2->ToggleActive(true);
			m_pPlayer3->ToggleActive(true);
			m_pPlayer4->ToggleActive(true);

			m_bMainGame = true;

			CGameState::GetInstance()->PassPlayers(m_pPlayer1, 1);
			CGameState::GetInstance()->PassPlayers(m_pPlayer2, 2);
			CGameState::GetInstance()->PassPlayers(m_pPlayer3, 3);
			CGameState::GetInstance()->PassPlayers(m_pPlayer4, 4);
			CGameState::GetInstance()->PassData(m_nRedScore, m_nBlueScore);

			Game::GetInstance()->ChangeState(CGameState::GetInstance());
		}
	}

}

void CDodgeBomb::Render(void)
{
	float width = Game::GetInstance()->GetScreenWidth();
	const Font* pFont = Game::GetInstance()->GetFont();


	if (flash)
	{
		SGD::GraphicsManager::GetInstance()->DrawTexture(boom, { 0, 0 }, 0.0f, {}, { 255, 255, 255 }, { 1, 1 });

		pFont->Draw("HalfTime", { 175, 1 }, 1, { 0, 0, 255 });
		pFont->Draw("Time For Some", { 40, 250 }, 1, { 0, 0, 255 });
		pFont->Draw("Dodge Bomb", { 100, 350 }, 1, { 0, 0, 255 });
	}
	else
	{
		CTileManager::GetInstance()->Render();

		m_pEntities->RenderAll();

		if (m_nDead >= 3)
		{
			const Font* pFont = Game::GetInstance()->GetFont();

			if (m_pPlayer1->CheckActive() == true)
			{
				pFont->Draw("Player 1 is the WINNER!!!", { 50, 0 }, 0.6f, {});
				m_bWon = true;
			}

			if (m_pPlayer2->CheckActive() == true)
			{
				pFont->Draw("Player 2 is the WINNER!!!", { 50, 0 }, 0.6f, {});
				m_bWon = true;
			}

			if (m_pPlayer3->CheckActive() == true)
			{
				pFont->Draw("Player 3 is the WINNER!!!", { 50, 0 }, 0.6f, {});
				m_bWon = true;
			}

			if (m_pPlayer4->CheckActive() == true)
			{
				pFont->Draw("Player 4 is the WINNER!!!", { 50, 0 }, 0.6f, {});
				m_bWon = true;
			}
		}

		SGD::OStringStream String;
		String << m_pPlayer1->GetCurrStamina();
		SGD::GraphicsManager::GetInstance()->DrawString(String.str().c_str(), { 0, 0 }, { 0, 0, 0 });

		SGD::OStringStream tOString;
		tOString << m_pPlayer2->GetCurrStamina();
		SGD::GraphicsManager::GetInstance()->DrawString(tOString.str().c_str(), { 750, 0 }, { 0, 0, 0 });

		SGD::OStringStream p1Charge;
		p1Charge << m_pPlayer1->GetCharge();
		SGD::GraphicsManager::GetInstance()->DrawString(p1Charge.str().c_str(), { 0, 500 }, { 0, 0, 0 });

		SGD::OStringStream time;
		time << (int)m_uGameTime;
		SGD::GraphicsManager::GetInstance()->DrawString(time.str().c_str(), { 400, 0 }, { 0, 0, 0 });

		SGD::OStringStream redScore;
		redScore << m_nRedScore;
		SGD::GraphicsManager::GetInstance()->DrawString(redScore.str().c_str(), { 370, 0 }, { 255, 0, 0 });

		SGD::OStringStream blueScore;
		blueScore << m_nBlueScore;
		SGD::GraphicsManager::GetInstance()->DrawString(blueScore.str().c_str(), { 450, 0 }, { 0, 0, 255 });

		pParticleSys->RenderAll();
		CAnimationManager::GetInstance()->RenderAll();
	}
}

void CDodgeBomb::PassPlayers(CPlayer* p, int playernumber)
{
	if (m_pEntities == nullptr)
	{
		m_pEntities = new EntityManager;
		CAnimationManager::GetInstance()->RemoveAll();
		CAnimationManager::GetInstance()->Initialize();
	}

	if (dynamic_cast<CRunner*>(p))
	{
		if (playernumber == 1)
		{


			m_pPlayer1 = new CRunner;
			*m_pPlayer1 = *p;
			m_pPlayer1->Release();
			m_pEntities->AddEntity(m_pPlayer1, BUCKET_PLAYERS);

			if (m_pPlayer1->GetTeam() == true)
				CAnimationManager::GetInstance()->SetOwner(reinterpret_cast<Entity*>(m_pPlayer1), "runnerIdleR");
			else
				CAnimationManager::GetInstance()->SetOwner(reinterpret_cast<Entity*>(m_pPlayer1), "runnerIdleB");

			CAnimationManager::GetInstance()->AddAnim(&reinterpret_cast<Entity*>(m_pPlayer1)->currAnimation);
		}
		else if (playernumber == 2)
		{
			m_pPlayer2 = new CRunner;
			*m_pPlayer2 = *p;
			m_pPlayer2->Release();
			m_pEntities->AddEntity(m_pPlayer2, BUCKET_PLAYERS);

			if (m_pPlayer2->GetTeam() == true)
				CAnimationManager::GetInstance()->SetOwner(reinterpret_cast<Entity*>(m_pPlayer2), "runnerIdleR");
			else
				CAnimationManager::GetInstance()->SetOwner(reinterpret_cast<Entity*>(m_pPlayer2), "runnerIdleB");

			CAnimationManager::GetInstance()->AddAnim(&reinterpret_cast<Entity*>(m_pPlayer2)->currAnimation);
		}
		else if (playernumber == 3)
		{
			m_pPlayer3 = new CRunner;
			*m_pPlayer3 = *p;
			m_pPlayer3->Release();
			m_pEntities->AddEntity(m_pPlayer3, BUCKET_PLAYERS);

			if (m_pPlayer3->GetTeam() == true)
				CAnimationManager::GetInstance()->SetOwner(reinterpret_cast<Entity*>(m_pPlayer3), "runnerIdleR");
			else
				CAnimationManager::GetInstance()->SetOwner(reinterpret_cast<Entity*>(m_pPlayer3), "runnerIdleB");

			CAnimationManager::GetInstance()->AddAnim(&reinterpret_cast<Entity*>(m_pPlayer3)->currAnimation);
		}
		else if (playernumber == 4)
		{
			m_pPlayer4 = new CRunner;
			*m_pPlayer4 = *p;
			m_pPlayer4->Release();
			m_pEntities->AddEntity(m_pPlayer4, BUCKET_PLAYERS);

			if (m_pPlayer4->GetTeam() == true)
				CAnimationManager::GetInstance()->SetOwner(reinterpret_cast<Entity*>(m_pPlayer4), "runnerIdleR");
			else
				CAnimationManager::GetInstance()->SetOwner(reinterpret_cast<Entity*>(m_pPlayer4), "runnerIdleB");

			CAnimationManager::GetInstance()->AddAnim(&reinterpret_cast<Entity*>(m_pPlayer4)->currAnimation);
		}


	}
	else if (dynamic_cast<CBomber*>(p))
	{
		if (playernumber == 1)
		{
			m_pPlayer1 = new CBomber;
			*m_pPlayer1 = *p;
			m_pPlayer1->Release();
			m_pEntities->AddEntity(m_pPlayer1, BUCKET_PLAYERS);

			if (m_pPlayer1->GetTeam() == true)
				CAnimationManager::GetInstance()->SetOwner(reinterpret_cast<Entity*>(m_pPlayer1), "bomberIdleR");
			else
				CAnimationManager::GetInstance()->SetOwner(reinterpret_cast<Entity*>(m_pPlayer1), "bomberIdleB");

			CAnimationManager::GetInstance()->AddAnim(&reinterpret_cast<Entity*>(m_pPlayer1)->currAnimation);
		}
		else if (playernumber == 2)
		{
			m_pPlayer2 = new CBomber;
			*m_pPlayer2 = *p;
			m_pPlayer2->Release();
			m_pEntities->AddEntity(m_pPlayer2, BUCKET_PLAYERS);

			if (m_pPlayer2->GetTeam() == true)
				CAnimationManager::GetInstance()->SetOwner(reinterpret_cast<Entity*>(m_pPlayer2), "bomberIdleR");
			else
				CAnimationManager::GetInstance()->SetOwner(reinterpret_cast<Entity*>(m_pPlayer2), "bomberIdleB");

			CAnimationManager::GetInstance()->AddAnim(&reinterpret_cast<Entity*>(m_pPlayer2)->currAnimation);
		}
		else if (playernumber == 3)
		{
			m_pPlayer3 = new CBomber;
			*m_pPlayer3 = *p;
			m_pPlayer3->Release();
			m_pEntities->AddEntity(m_pPlayer3, BUCKET_PLAYERS);

			if (m_pPlayer3->GetTeam() == true)
				CAnimationManager::GetInstance()->SetOwner(reinterpret_cast<Entity*>(m_pPlayer3), "bomberIdleR");
			else
				CAnimationManager::GetInstance()->SetOwner(reinterpret_cast<Entity*>(m_pPlayer3), "bomberIdleB");

			CAnimationManager::GetInstance()->AddAnim(&reinterpret_cast<Entity*>(m_pPlayer3)->currAnimation);
		}
		else if (playernumber == 4)
		{
			m_pPlayer4 = new CBomber;
			*m_pPlayer4 = *p;
			m_pPlayer4->Release();
			m_pEntities->AddEntity(m_pPlayer4, BUCKET_PLAYERS);

			if (m_pPlayer4->GetTeam() == true)
				CAnimationManager::GetInstance()->SetOwner(reinterpret_cast<Entity*>(m_pPlayer4), "bomberIdleR");
			else
				CAnimationManager::GetInstance()->SetOwner(reinterpret_cast<Entity*>(m_pPlayer4), "bomberIdleB");

			CAnimationManager::GetInstance()->AddAnim(&reinterpret_cast<Entity*>(m_pPlayer4)->currAnimation);
		}
	}
	else if (dynamic_cast<CStriker*>(p))
	{
		if (playernumber == 1)
		{
			m_pPlayer1 = new CStriker;
			*m_pPlayer1 = *p;
			m_pPlayer1->Release();
			m_pEntities->AddEntity(m_pPlayer1, BUCKET_PLAYERS);

			if (m_pPlayer1->GetTeam() == true)
				CAnimationManager::GetInstance()->SetOwner(reinterpret_cast<Entity*>(m_pPlayer1), "strikerIdleR");
			else
				CAnimationManager::GetInstance()->SetOwner(reinterpret_cast<Entity*>(m_pPlayer1), "strikerIdleB");

			CAnimationManager::GetInstance()->AddAnim(&reinterpret_cast<Entity*>(m_pPlayer1)->currAnimation);
		}
		else if (playernumber == 2)
		{
			m_pPlayer2 = new CStriker;
			*m_pPlayer2 = *p;
			m_pPlayer2->Release();
			m_pEntities->AddEntity(m_pPlayer2, BUCKET_PLAYERS);

			if (m_pPlayer2->GetTeam() == true)
				CAnimationManager::GetInstance()->SetOwner(reinterpret_cast<Entity*>(m_pPlayer2), "strikerIdleR");
			else
				CAnimationManager::GetInstance()->SetOwner(reinterpret_cast<Entity*>(m_pPlayer2), "strikerIdleB");

			CAnimationManager::GetInstance()->AddAnim(&reinterpret_cast<Entity*>(m_pPlayer2)->currAnimation);
		}
		else if (playernumber == 3)
		{
			m_pPlayer3 = new CStriker;
			*m_pPlayer3 = *p;
			m_pPlayer3->Release();
			m_pEntities->AddEntity(m_pPlayer3, BUCKET_PLAYERS);

			if (m_pPlayer3->GetTeam() == true)
				CAnimationManager::GetInstance()->SetOwner(reinterpret_cast<Entity*>(m_pPlayer3), "strikerIdleR");
			else
				CAnimationManager::GetInstance()->SetOwner(reinterpret_cast<Entity*>(m_pPlayer3), "strikerIdleB");

			CAnimationManager::GetInstance()->AddAnim(&reinterpret_cast<Entity*>(m_pPlayer3)->currAnimation);
		}
		else if (playernumber == 4)
		{
			m_pPlayer4 = new CStriker;
			*m_pPlayer4 = *p;
			m_pPlayer4->Release();
			m_pEntities->AddEntity(m_pPlayer4, BUCKET_PLAYERS);

			if (m_pPlayer4->GetTeam() == true)
				CAnimationManager::GetInstance()->SetOwner(reinterpret_cast<Entity*>(m_pPlayer4), "strikerIdleR");
			else
				CAnimationManager::GetInstance()->SetOwner(reinterpret_cast<Entity*>(m_pPlayer4), "strikerIdleB");

			CAnimationManager::GetInstance()->AddAnim(&reinterpret_cast<Entity*>(m_pPlayer4)->currAnimation);
		}
	}
	else if (dynamic_cast<CTank*>(p))
	{
		if (playernumber == 1)
		{
			m_pPlayer1 = new CTank;
			*m_pPlayer1 = *p;
			m_pPlayer1->Release();
			m_pEntities->AddEntity(m_pPlayer1, BUCKET_PLAYERS);

			if (m_pPlayer1->GetTeam() == true)
				CAnimationManager::GetInstance()->SetOwner(reinterpret_cast<Entity*>(m_pPlayer1), "tankIdleR");
			else
				CAnimationManager::GetInstance()->SetOwner(reinterpret_cast<Entity*>(m_pPlayer1), "tankIdleB");

			CAnimationManager::GetInstance()->AddAnim(&reinterpret_cast<Entity*>(m_pPlayer1)->currAnimation);
		}
		else if (playernumber == 2)
		{
			m_pPlayer2 = new CTank;
			*m_pPlayer2 = *p;
			m_pPlayer2->Release();
			m_pEntities->AddEntity(m_pPlayer2, BUCKET_PLAYERS);

			if (m_pPlayer2->GetTeam() == true)
				CAnimationManager::GetInstance()->SetOwner(reinterpret_cast<Entity*>(m_pPlayer2), "tankIdleR");
			else
				CAnimationManager::GetInstance()->SetOwner(reinterpret_cast<Entity*>(m_pPlayer2), "tankIdleB");

			CAnimationManager::GetInstance()->AddAnim(&reinterpret_cast<Entity*>(m_pPlayer2)->currAnimation);
		}
		else if (playernumber == 3)
		{
			m_pPlayer3 = new CTank;
			*m_pPlayer3 = *p;
			m_pPlayer3->Release();
			m_pEntities->AddEntity(m_pPlayer3, BUCKET_PLAYERS);

			if (m_pPlayer3->GetTeam() == true)
				CAnimationManager::GetInstance()->SetOwner(reinterpret_cast<Entity*>(m_pPlayer3), "tankIdleR");
			else
				CAnimationManager::GetInstance()->SetOwner(reinterpret_cast<Entity*>(m_pPlayer3), "tankIdleB");

			CAnimationManager::GetInstance()->AddAnim(&reinterpret_cast<Entity*>(m_pPlayer3)->currAnimation);
		}
		else if (playernumber == 4)
		{
			m_pPlayer4 = new CTank;
			*m_pPlayer4 = *p;
			m_pPlayer4->Release();
			m_pEntities->AddEntity(m_pPlayer4, BUCKET_PLAYERS);

			if (m_pPlayer4->GetTeam() == true)
				CAnimationManager::GetInstance()->SetOwner(reinterpret_cast<Entity*>(m_pPlayer4), "tankIdleR");
			else
				CAnimationManager::GetInstance()->SetOwner(reinterpret_cast<Entity*>(m_pPlayer4), "tankIdleB");

			CAnimationManager::GetInstance()->AddAnim(&reinterpret_cast<Entity*>(m_pPlayer4)->currAnimation);
		}
	}
}

Entity* CDodgeBomb::CreateBall(SGD::Point position, SGD::Size size)
{
	CDodgeball* tempBall = new CDodgeball;

	tempBall->SetPosition(position);
	tempBall->SetSize(size);
	tempBall->SetVelocity({ 0, 0 });

	return tempBall;
}

void CDodgeBomb::PassData(int redscore, int bluescore)
{
	m_nRedScore = redscore;
	m_nBlueScore = bluescore;
}

Entity* CDodgeBomb::CreatePunch(Entity* pOwner) const
{
	CPunch* p = new CPunch;
	p->SetOwner(pOwner);
	if (dynamic_cast<CPlayer*>(pOwner)->GetHeading())
	{
		p->SetPosition(SGD::Point{ pOwner->GetPosition().x + pOwner->GetSize().width, pOwner->GetPosition().y + 30 });
	}
	else
		p->SetPosition(SGD::Point{ pOwner->GetPosition().x - 40, pOwner->GetPosition().y + 30 });

	p->SetHeading(dynamic_cast<CPlayer*>(pOwner)->GetHeading());
	p->SetRotation(pOwner->GetRotation());
	p->SetSize({ 30, 8 });

	p->SetPunchTimer(0.1f);
	m_pEntities->AddEntity(p, BUCKET_PUNCH);
	return p;
}

void CDodgeBomb::DeleteEntity(Entity* e)
{
	m_pEntities->RemoveEntity(e);
}

